#include "reg52.h"
#include "PinSettings.h"
#include "DS18B20.h"
#include "LCD1602.h"

//初始化函数
void setup();

//循环函数
void go();

//声明全局变量
uchar TempChar[6];                      //6位温度字符，例如-13.26
uchar Row_1st[16] = " Temp:          "; //LCD显示的第一行
uchar Row_2st[16] = " HCB 1911070154 "; //LCD显示的第二行

int main()
{
    setup();
    while (1)
        go();
}

void setup()
{
    DS18B20_ChangTemp(); //进行温度变换
    LCD_Init();          //LCD屏幕清屏
}

void go()
{
    uchar i;

    DS18B20_TransTemp(TempChar);

    for (i = 0; i < 6; i++)
    {
        Row_1st[i + 7] = TempChar[i];
    }

    for (i = 0; i < 16; i++)
    {
        LCD_DisplayChar(1, i, Row_1st[i]);
        LCD_DisplayChar(2, i, Row_2st[i]);
    }
}